﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/group/GroupMasterPage.Master" AutoEventWireup="true"
    CodeBehind="List.aspx.cs" Inherits="Yonkly.Views.Group.List" %>

<%@ Import Namespace="Yonkly.Controllers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

  
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">

    <script type="text/javascript">
        $(document).ready(function() {
//            $("#tblGroups tbody tr").mouseover(function() {
//                $(this).addClass("hilite");
//            }).mouseout(function() {
//                $(this).removeClass("hilite");
//            });
            $("#tblGroups tbody tr:odd").addClass("odd");
            $("#tblGroups tbody tr:even").addClass("even");

        });
    </script>

    <%if (ViewData.Model.IsAuthenticated)
      { %>
    <h2>
        My Groups (<%=Html.ActionLink<GroupController>(g => g.New(), "create group")%>)</h2>
    <table id="tblGroups" style="width: 100%;">
        <thead>
            <tr>
                <th>
                </th>
            </tr>
        </thead>
        <tbody>
            <%
                foreach (var group in ViewData.Model.LoggedInUser.Groups)
                {%>
            <tr>
                <%--<td>
                    <a href="#">leave</a>
                </td>
                <td>
                    <a href="#" >delete</a>
                </td>--%>
                <td>
                    <a href='/group/<%=group.Url %>'>
                        <%=group.Name%></a>
                </td>
            </tr>
            <%
                }%>
        </tbody>
    </table>
    <%} %>
    <h2>
        Top Groups</h2>
    <table id="Table1" style="width: 100%;">
        <tbody>
            <%
                foreach (var group in ViewData.Model.TopGroups)
                {%>
            <tr>
                <td>
                    <a href='/group/<%=group.Url %>'>
                        <%=group.Name%></a>
                </td>
            </tr>
            <%
                }%>
        </tbody>
    </table>
</asp:Content>
